//
//  CommentHeaderCell.m
//  IfengNews
//
//  Created by tianhongyin on 14-10-16.
//
//

#import "CommentHeaderCell.h"

@interface CommentHeaderCell()

@property (nonatomic, strong) UILabel *sectionLab;

@end

@implementation CommentHeaderCell

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if(self = [super initWithStyle:style reuseIdentifier:reuseIdentifier])
    {
        [self createTitle];
    }
    
    return self;
}

- (void)createTitle
{
    
    UIView *headerView = [[UIView alloc] init];
    headerView.frame = CGRectMake(0, 0, 320, 50);
    headerView.backgroundColor =RGB(0xf7, 0xf7, 0xf7);
    
    _sectionLab = [UILabel new];
    _sectionLab.backgroundColor = [UIColor clearColor];
    _sectionLab.font = [UIFont boldSystemFontOfSize:16];
    _sectionLab.textColor = RGB(0xf5, 0x43, 0x43);
    _sectionLab.frame = CGRectMake(15, 19, 200, 16);
    [headerView addSubview:_sectionLab];
    
    UIView *line = [UIView new];
    line.frame = CGRectMake(53, CGRectGetHeight(headerView.frame)-0.5, 254, 0.5);
    line.backgroundColor = RGB(0xd7, 0xd7, 0xd7);
    [headerView addSubview:line];
    
    [self addSubview:headerView];
}

- (void)loadTitle
{
    if(_sectionLab)
    {
        NSString *text = nil;
        int section = self.indexPath.section;
        if(section == 0)
        {
            text = @"| 热门评论";
        }
        else if (1==section)
        {
            text = @"| 最新评论";
        }
        _sectionLab.text = text;
    }
}

@end
